<?
class RequireAction extends BaseAction {

  public function index() {

  }

  //我的发布
  public function publishs() {
    $m = M("ARequire");
    import("@.ORG.Page"); //导入分页类
    $records = 20;//每页多少条记录
    $where = 'uid = '.$this->_uid;
    $count = $m->where($where)->count();
    $p = new Page ($count,$records);
    $p->setConfig('header','篇记录');
    $p->setConfig('prev',"上一页");
    $p->setConfig('next','下一页');
    $p->setConfig('first','<<');
    $p->setConfig('last','>>');
    $page = $p->show();
    $list = $m->where($where)->order("pub_time desc")->limit($p->firstRow.",".$p->listRows)->select();
    $this->assign("count", $count);
    $this->assign("list", $list);
    $this->assign("nowPage",$p->nowPage);
    $this->assign("page", $page );
    $this->assign("records",$records);
    $this->display();
  }

  //删除记录
  public function del(){
    $m = M();
    $result = $m->query('delete from a_require where id = '.$_GET['id']);
    if ($result === false) $this->error('删除失败');
    else $this->success('删除成功');
  }
}
?>